Question 1

Question 2

Question 1

What is the purpose of system calls?

System calls allow user-level processes to request services of the operating system. 



Question 2

List five services provided by an operating system, and explain how each creates convenience for users. 
In which cases would it be impossible for user-level programs to provide these services? Explain your answer.

    The five main services are, not inclusive of accounting, and protection and security:

1. Program execution: 
   The operating system loads the contents (or sections) of a file into memory and begins its execution. 
   A user-level program could not be trusted to properly allocate CPU time.

2. I/O operations: 
   Disks, tapes, serial lines, and other devices must be communicated with at a very low level. 
   The user need only specify the device and the operation to perform on it, while the system converts that request into device-specific commands. 
   User-level programs cannot be trusted to access only devices they should have access to and to access them only when they are otherwise unused.

3. File-system manipulation: 
   File creation, deletion, allocation, and naming require many details that users should not have to handle. 
   Blocks of disk space are used by files and must be tracked. 
   Deleting a file requires removing the file name information and freeing the allocated blocks. 
   User programs could neither ensure adherence to protection methods nor be trusted to allocate only free blocks and deallocate blocks on file deletion.

4. Communications: 
   Message passing between systems requires converting messages into packets, sending them to the network controller, 
   transmitting across a communication medium, and reassembling by the destination system. 
   Packet ordering and data correction must take place. 
   User programs might not coordinate access to the network device or might receive packets destined for other processes.

5. Error detection: 
   At both hardware and software levels, data transfers and media must be inspected to ensure they have not been corrupted. 
   Error detection at the hardware level and checking for consistency at the software level (e.g., allocation and unallocated blocks on a device) must be handled globally. 
   User processes would not be able to handle all types of errors.



Question 3

What is the purpose of system programs?

System programs can be thought of as bundles of useful system calls.
They provide basic functionality to users, so that users do not need to write their own programs to solve common problems.



Question 4

Describe three general methods for passing parameters to the operating system.

1. Pass parameters in registers: 
   Parameters are passed directly in registers, which are fast to access.

2. Registers pass starting addresses of blocks of parameters: 
   In this method, registers are used to pass the starting addresses of larger parameter blocks, which the operating system will use.

3. Parameters placed on the stack: 
   Parameters can be pushed onto the stack by the program, and then popped off by the operating system when needed.



Question 5

Would it be possible for the user to develop a new command interpreter using the system-call interface provided by the operating system?

Yes, it would be possible for the user to develop a new command interpreter using the system-call interface provided by the operating system. 
The command interpreter allows a user to create and manage processes and determine ways for these processes to communicate (such as through pipes and files). 
As all of these functionalities are accessible by a user-level program using system calls, it should be possible to develop a new command-line interpreter.



Question 6

What is the main advantage of the microkernel approach to system design? 
How do user programs and system services interact in a microkernel architecture? What are the disadvantages of using the microkernel approach?

Advantages:
a. Adding a new service does not require modifying the kernel.  
b. It is more secure as more operations are performed in user mode rather than kernel mode.  
c. A simpler kernel design and functionality typically result in a more reliable operating system.

Interaction in microkernel architecture:
User programs and system services interact through interprocess communication mechanisms such as messaging, with messages conveyed by the operating system.

Disadvantages:
The main disadvantages of the microkernel architecture include the overheads associated with interprocess communication 
and the frequent use of the operating system’s messaging functions, which can slow down the interaction between user processes and system services.



Question 7

In what ways is the modular kernel approach similar to the layered approach? In what ways does it differ from the layered approach?

Both the modular kernel approach and the layered approach require subsystems to interact through carefully constructed interfaces that are typically narrow. 
However, the layered kernel imposes a strict ordering of subsystems, where subsystems at lower layers cannot invoke operations from upper-layer subsystems. 
In contrast, the modular kernel allows modules to invoke each other freely without any such restrictions.



Question 8

What is the relationship between a guest operating system and a host operating system in a system like VMware? 
What factors need to be considered in choosing the host operating system?

In a system like VMware, the guest operating system provides its services by mapping them onto the functionality provided by the host operating system. 
When choosing the host operating system, it is important to consider whether its system-call interface is sufficiently general 
to support the functionality of the guest operating system.